package com.ymatou.app.seller.testcase;

import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.app.seller.parameter.ActivityTabProductListBean;
import com.ymatou.app.seller.service.ActivityTabProductListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AuthCallService;
/**
*获取商品直播商品接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_ActivityTabProductList{
	private static ActivityTabProductListBean activitytabproductlistBean;
	private static ActivityTabProductListCall activitytabproductlistCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取商品直播商品接口");
	}

	@Before
	public void caseUp() {
		activitytabproductlistBean=new ActivityTabProductListBean();
		activitytabproductlistCall=new ActivityTabProductListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(activitytabproductlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ActivityTabProductList_001() {
		Logger.start(true,"获取直播商品成功");
		try {
			Map m=AuthCallService.authLogin("sellerkorea1", "123456");
			String AccessToken = (String)m.get("AccessToken");
			int activityId=147864;		
			activitytabproductlistBean.setAccessToken(AccessToken);
			activitytabproductlistBean.setActivityId(activityId);
			activitytabproductlistBean.setIsReplay(false);		
			//查询返回一个商品
			activitytabproductlistBean.setProductNum(10);
			//商品状态(ReadyPutaway：待上架、Putaway：上架、Soldout：售罄、Putout：下架)
			activitytabproductlistBean.setTabName("Putaway");			
			activitytabproductlistCall.setData(activitytabproductlistBean);
			activitytabproductlistCall.callService();			
			Logger.comment("activitytabproductlistCall send:" + activitytabproductlistCall.getEntityString());
			Logger.comment("activitytabproductlistCall response:" + activitytabproductlistCall.getReturnData());
			
			Logger.verifyEquals(200, activitytabproductlistCall.getStatus(), "验证查询直播商品是否成功");
			Logger.comment("商品id:"+activitytabproductlistCall.getProductId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}